<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Docker 学习 | 仲灏小栈</title>
    <meta name="generator" content="VuePress 1.8.0">
    <link rel="icon" href="/img/favicon.ico">
    <meta name="description" content="专注web全栈学习与总结。JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github等技术文章。">
    <meta name="keywords" content="前端博客,个人技术博客,前端,前端开发,前端框架,web前端,前端面试题,技术文档,学习,面试,JavaScript,js,ES6,TypeScript,vue,python,css3,html5,Node,git,github,markdown">
    <meta name="baidu-site-verification" content="code-5CGlqw1B4p">
    <meta name="google-site-verification" content="PbO8RiLRwDnNwqNFNGnaxZnEFB3CqcGMCGoloYfQXV0">
    <meta name="theme-color" content="#11a8cd">
    
    <link rel="preload" href="/assets/css/0.styles.15972595.css" as="style"><link rel="preload" href="/assets/js/app.2005d9cf.js" as="script"><link rel="preload" href="/assets/js/2.26fadcea.js" as="script"><link rel="preload" href="/assets/js/62.ec59ffa8.js" as="script"><link rel="prefetch" href="/assets/js/10.0a7a4ca4.js"><link rel="prefetch" href="/assets/js/100.3309ce28.js"><link rel="prefetch" href="/assets/js/101.ac045b1a.js"><link rel="prefetch" href="/assets/js/102.e80bc311.js"><link rel="prefetch" href="/assets/js/103.bf660db8.js"><link rel="prefetch" href="/assets/js/104.b26aecd4.js"><link rel="prefetch" href="/assets/js/105.0e9ab80d.js"><link rel="prefetch" href="/assets/js/106.b590426c.js"><link rel="prefetch" href="/assets/js/107.5bf74c11.js"><link rel="prefetch" href="/assets/js/108.ffdc48f3.js"><link rel="prefetch" href="/assets/js/109.8da9360f.js"><link rel="prefetch" href="/assets/js/11.d9ff276d.js"><link rel="prefetch" href="/assets/js/110.3986bd59.js"><link rel="prefetch" href="/assets/js/111.1522ded7.js"><link rel="prefetch" href="/assets/js/12.1fe7afa3.js"><link rel="prefetch" href="/assets/js/13.5e3a6c9a.js"><link rel="prefetch" href="/assets/js/14.541bbe3d.js"><link rel="prefetch" href="/assets/js/15.f7a50163.js"><link rel="prefetch" href="/assets/js/16.2f792024.js"><link rel="prefetch" href="/assets/js/17.a1b6c76e.js"><link rel="prefetch" href="/assets/js/18.44579087.js"><link rel="prefetch" href="/assets/js/19.4ea5fdf4.js"><link rel="prefetch" href="/assets/js/20.e975ae71.js"><link rel="prefetch" href="/assets/js/21.8f6a653b.js"><link rel="prefetch" href="/assets/js/22.f7fe055a.js"><link rel="prefetch" href="/assets/js/23.e404dad6.js"><link rel="prefetch" href="/assets/js/24.fe3bc22e.js"><link rel="prefetch" href="/assets/js/25.85d2cc13.js"><link rel="prefetch" href="/assets/js/26.9f14e07f.js"><link rel="prefetch" href="/assets/js/27.d49bdf6c.js"><link rel="prefetch" href="/assets/js/28.72ba52cd.js"><link rel="prefetch" href="/assets/js/29.2e392833.js"><link rel="prefetch" href="/assets/js/3.7675493a.js"><link rel="prefetch" href="/assets/js/30.b69d63e5.js"><link rel="prefetch" href="/assets/js/31.c99d1817.js"><link rel="prefetch" href="/assets/js/32.6d83d1c4.js"><link rel="prefetch" href="/assets/js/33.bebcb9b5.js"><link rel="prefetch" href="/assets/js/34.8f621c93.js"><link rel="prefetch" href="/assets/js/35.6606e0ad.js"><link rel="prefetch" href="/assets/js/36.75614371.js"><link rel="prefetch" href="/assets/js/37.4ce9e497.js"><link rel="prefetch" href="/assets/js/38.95263d32.js"><link rel="prefetch" href="/assets/js/39.a86d2616.js"><link rel="prefetch" href="/assets/js/4.d95386e0.js"><link rel="prefetch" href="/assets/js/40.e7f88f7e.js"><link rel="prefetch" href="/assets/js/41.644d2886.js"><link rel="prefetch" href="/assets/js/42.a9398322.js"><link rel="prefetch" href="/assets/js/43.50ffced2.js"><link rel="prefetch" href="/assets/js/44.8a76f778.js"><link rel="prefetch" href="/assets/js/45.d825d0e7.js"><link rel="prefetch" href="/assets/js/46.e692b0d4.js"><link rel="prefetch" href="/assets/js/47.4a5600e2.js"><link rel="prefetch" href="/assets/js/48.b58a480d.js"><link rel="prefetch" href="/assets/js/49.c31716d2.js"><link rel="prefetch" href="/assets/js/5.77e36999.js"><link rel="prefetch" href="/assets/js/50.5c5f704f.js"><link rel="prefetch" href="/assets/js/51.3b090e9a.js"><link rel="prefetch" href="/assets/js/52.a2846fa7.js"><link rel="prefetch" href="/assets/js/53.08563d97.js"><link rel="prefetch" href="/assets/js/54.abaa1adf.js"><link rel="prefetch" href="/assets/js/55.79ddef5b.js"><link rel="prefetch" href="/assets/js/56.8fc21a8e.js"><link rel="prefetch" href="/assets/js/57.a7a7e91e.js"><link rel="prefetch" href="/assets/js/58.395fd83e.js"><link rel="prefetch" href="/assets/js/59.b2899c75.js"><link rel="prefetch" href="/assets/js/6.ed7c7deb.js"><link rel="prefetch" href="/assets/js/60.12cf70af.js"><link rel="prefetch" href="/assets/js/61.bbb7862b.js"><link rel="prefetch" href="/assets/js/63.f4d6c257.js"><link rel="prefetch" href="/assets/js/64.9e382220.js"><link rel="prefetch" href="/assets/js/65.94ab71cc.js"><link rel="prefetch" href="/assets/js/66.33c7d856.js"><link rel="prefetch" href="/assets/js/67.6d9b7cc8.js"><link rel="prefetch" href="/assets/js/68.63f4486e.js"><link rel="prefetch" href="/assets/js/69.fd717229.js"><link rel="prefetch" href="/assets/js/7.05321aa0.js"><link rel="prefetch" href="/assets/js/70.b37bad49.js"><link rel="prefetch" href="/assets/js/71.bf0f14a3.js"><link rel="prefetch" href="/assets/js/72.37e36450.js"><link rel="prefetch" href="/assets/js/73.d6b8cf7a.js"><link rel="prefetch" href="/assets/js/74.66cae9eb.js"><link rel="prefetch" href="/assets/js/75.f56a19ed.js"><link rel="prefetch" href="/assets/js/76.e9d0a86e.js"><link rel="prefetch" href="/assets/js/77.6f880a29.js"><link rel="prefetch" href="/assets/js/78.bd4f38f3.js"><link rel="prefetch" href="/assets/js/79.f22e09a9.js"><link rel="prefetch" href="/assets/js/8.58ff24c5.js"><link rel="prefetch" href="/assets/js/80.c7a75ffd.js"><link rel="prefetch" href="/assets/js/81.60c66414.js"><link rel="prefetch" href="/assets/js/82.1cac8d03.js"><link rel="prefetch" href="/assets/js/83.dca1d99b.js"><link rel="prefetch" href="/assets/js/84.8c41ec82.js"><link rel="prefetch" href="/assets/js/85.af3896bc.js"><link rel="prefetch" href="/assets/js/86.b30b6900.js"><link rel="prefetch" href="/assets/js/87.b51ef412.js"><link rel="prefetch" href="/assets/js/88.d3803962.js"><link rel="prefetch" href="/assets/js/89.7d9cb78b.js"><link rel="prefetch" href="/assets/js/9.40722af3.js"><link rel="prefetch" href="/assets/js/90.31875659.js"><link rel="prefetch" href="/assets/js/91.6be253a0.js"><link rel="prefetch" href="/assets/js/92.db3fd2c0.js"><link rel="prefetch" href="/assets/js/93.0eae35a1.js"><link rel="prefetch" href="/assets/js/94.3068fcfa.js"><link rel="prefetch" href="/assets/js/95.0aa43f4e.js"><link rel="prefetch" href="/assets/js/96.5dd378f0.js"><link rel="prefetch" href="/assets/js/97.f475d7a5.js"><link rel="prefetch" href="/assets/js/98.c7b425d3.js"><link rel="prefetch" href="/assets/js/99.91630bf2.js">
    <link rel="stylesheet" href="/assets/css/0.styles.15972595.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu have-body-img"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/img/logo.png" alt="仲灏小栈" class="logo"> <span class="site-name can-hide">仲灏小栈</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><a href="/web/" class="nav-link">大前端</a></div><div class="nav-item"><a href="/backend-opt/" class="nav-link">后端&amp;运维</a></div><div class="nav-item"><a href="/other-tech/" class="nav-link">其他</a></div><div class="nav-item"><a href="/tech-live/" class="nav-link">生活</a></div><div class="nav-item"><a href="/about/" class="nav-link">关于我</a></div><div class="nav-item"><a href="/favorite/" class="nav-link">收藏</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="索引" class="dropdown-title"><a href="/archives/" class="link-title">索引</a> <span class="title" style="display:none;">索引</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/" class="nav-link">分类</a></li><li class="dropdown-item"><!----> <a href="/tags/" class="nav-link">标签</a></li><li class="dropdown-item"><!----> <a href="/archives/" class="nav-link">归档</a></li></ul></div></div> <a href="https://github.com/izhaong" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><div class="blogger"><img src="https://cdn.jsdelivr.net/gh/izhaong/izhaong.com-oss/site-data/avatar/avatar-wx.jpg"> <div class="blogger-info"><h3>仲灏</h3> <span>诚意, 正心, 格物, 致知</span></div></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><a href="/web/" class="nav-link">大前端</a></div><div class="nav-item"><a href="/backend-opt/" class="nav-link">后端&amp;运维</a></div><div class="nav-item"><a href="/other-tech/" class="nav-link">其他</a></div><div class="nav-item"><a href="/tech-live/" class="nav-link">生活</a></div><div class="nav-item"><a href="/about/" class="nav-link">关于我</a></div><div class="nav-item"><a href="/favorite/" class="nav-link">收藏</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="索引" class="dropdown-title"><a href="/archives/" class="link-title">索引</a> <span class="title" style="display:none;">索引</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/" class="nav-link">分类</a></li><li class="dropdown-item"><!----> <a href="/tags/" class="nav-link">标签</a></li><li class="dropdown-item"><!----> <a href="/archives/" class="nav-link">归档</a></li></ul></div></div> <a href="https://github.com/izhaong" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Java</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/pages/7e33b1/" class="sidebar-link">java初学者maven项目建立</a></li><li><a href="/pages/560807/" class="sidebar-link">Maven学习笔记</a></li><li><a href="/pages/b4e72c/" class="sidebar-link">开源的物联网平台thingsboard部署</a></li><li><a href="/pages/3eb92e/" aria-current="page" class="active sidebar-link">Docker 学习</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#docker安装及使用教程" class="sidebar-link">Docker安装及使用教程</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#卸载docker" class="sidebar-link">卸载docker</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#安装docker" class="sidebar-link">安装docker</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#docker镜像加速" class="sidebar-link">docker镜像加速</a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#docker-入门教程" class="sidebar-link">Docker 入门教程</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#image-文件" class="sidebar-link">image 文件</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#容器文件" class="sidebar-link">容器文件</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#实例" class="sidebar-link">实例</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#dockerfile" class="sidebar-link">dockerFile</a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#gui-工具" class="sidebar-link">GUI 工具</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#常用命令汇总" class="sidebar-link">常用命令汇总</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#命令行技巧" class="sidebar-link">命令行技巧</a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#docker配置" class="sidebar-link">docker配置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#etc-docker-daemon-json" class="sidebar-link">/etc/docker/daemon.json</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#更换镜像源" class="sidebar-link">更换镜像源</a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#原理" class="sidebar-link">原理</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#cnm" class="sidebar-link">CNM</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#容器内部网络空间是否与外面一致" class="sidebar-link">容器内部网络空间是否与外面一致</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#" class="sidebar-link"></a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#-2" class="sidebar-link"></a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#docker-微服务" class="sidebar-link">docker 微服务</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#-3" class="sidebar-link"></a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#nginx-容器教程" class="sidebar-link">Nginx 容器教程</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#http-服务" class="sidebar-link">HTTP 服务</a></li></ul></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#映射网页目录" class="sidebar-link">映射网页目录</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#使用的案例" class="sidebar-link">使用的案例</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#在使用docker中遇到的问题-需求" class="sidebar-link">在使用docker中遇到的问题&amp;需求</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/pages/3eb92e/#问题" class="sidebar-link">问题</a></li><li class="sidebar-sub-header"><a href="/pages/3eb92e/#需求收集" class="sidebar-link">需求收集</a></li></ul></li></ul></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Docker</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Nacos</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Nginx</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Linux</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Git</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>其他</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-0c557b5e><div class="articleInfo" data-v-0c557b5e><ul class="breadcrumbs" data-v-0c557b5e><li data-v-0c557b5e><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-0c557b5e></a></li> <li data-v-0c557b5e><a href="/backend-opt/#后端&amp;运维" data-v-0c557b5e>后端&amp;运维</a></li><li data-v-0c557b5e><a href="/backend-opt/#Java" data-v-0c557b5e>Java</a></li></ul> <div class="info" data-v-0c557b5e><div title="作者" class="author iconfont icon-touxiang" data-v-0c557b5e><a href="https://github.com/izhaong" target="_blank" title="作者" class="beLink" data-v-0c557b5e>仲灏</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-0c557b5e><a href="javascript:;" data-v-0c557b5e>2021-11-30</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-content"></div></div></div> <h1><img src="">Docker 学习<!----></h1> <!----> <div class="theme-vdoing-content content__default"><p><em>前言: 因为写项目时需要用到<code>mysql</code> <code>postgres``mongodb``redis</code>一些数据库 不想再自己电脑上安装这些 使用率不是很多 就想到了docker, 无论在服务器还时自己的电脑上, 感觉docker更符合我的场景</em></p> <h2 id="docker安装及使用教程"><a href="#docker安装及使用教程" class="header-anchor">#</a> <a href="https://juejin.im/post/6844904201990963213" target="_blank" rel="noopener noreferrer">Docker安装及使用教程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></h2> <h3 id="卸载docker"><a href="#卸载docker" class="header-anchor">#</a> 卸载docker</h3> <p>1.  先查询下docker： yum list installed|grep docker ，然后执行卸载命令：<code>yum -y remove  docker.x86_64   docker-client.x86_64  docker-common.x86_64</code>
2.  执行删除已存在的镜像和容器（以实际情况而定）： <code>rm -rf  /var/lib/docker</code></p> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 删除相关组件</span>
<span class="token comment"># 如果使用种方式的话，需要罗列全部使安装过的组件；</span>
yum remove docker <span class="token punctuation">\</span>
  docker-client <span class="token punctuation">\</span>
  docker-client-latest <span class="token punctuation">\</span>
  docker-common <span class="token punctuation">\</span>
  docker-latest <span class="token punctuation">\</span>
  docker-latest-logrotate <span class="token punctuation">\</span>
  docker-logrotate <span class="token punctuation">\</span>
  docker-selinux <span class="token punctuation">\</span>
  docker-engine-selinux <span class="token punctuation">\</span>
  docker-engine
                
<span class="token comment"># 第二种方式，使用匹配符直接删除全部</span>
<span class="token comment"># 推荐使用第二种方式，无需罗列所有的安装组件</span>
yum remove docker docker-*
<span class="token comment"># 删除注册的服务</span>
<span class="token function">rm</span> -rf /etc/systemd/system/docker.service.d
<span class="token comment"># 删除docker工作目录</span>
<span class="token function">rm</span> -rf /var/lib/docker*
<span class="token function">rm</span> -rf /var/run/docker*
<span class="token comment"># 删除配置文件</span>
<span class="token comment"># 直接清空这个文件夹，下面所有配置都将被清空</span>
<span class="token function">rm</span> -rf /etc/docker
<span class="token comment">#----------------------------#</span>
<span class="token comment"># /etc/docker/daemon.json    #</span>
<span class="token comment"># /ect/docker/key.json       #</span>
<span class="token comment">#----------------------------#</span>
<span class="token comment"># 查找残留的docker</span>
<span class="token function">rpm</span> -qa<span class="token operator">|</span><span class="token function">grep</span> docker
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br></div></div><h3 id="安装docker"><a href="#安装docker" class="header-anchor">#</a> 安装docker</h3> <div class="language- line-numbers-mode"><pre class="language-text"><code># 第一步，需要安装一些依赖组件
# 安装所需的软件包。yum-utils 提供了 yum-config-manager，
# 并且 device mapper 存储驱动程序需要 device-mapper-persistent-data 和 lvm2。
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
# 使用以下命令来获得稳定的仓库
# 阿里云源地址速度相对比较快，这里是设置源地址为阿里云的镜像仓库地址。
# yum-config-manager \
#    --add-repo \
#    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
# 安装 Docker Engine-Community
yum install -y docker-ce docker-ce-cli containerd.io
# 将当前用户添加到docker用户组
usermod -aG docker ${USER}
# Docker默认未启动，需要手动重启docker服务
systemctl restart docker
systemctl start docker
systemctl stop docker
# 切换当前会话到docker组
newgrp - docker
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div><h3 id="docker镜像加速"><a href="#docker镜像加速" class="header-anchor">#</a> docker镜像加速</h3> <div class="language- line-numbers-mode"><pre class="language-text"><code>sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json &lt;&lt;-'EOF'
{
  &quot;registry-mirrors&quot;: [ &quot;https://fpr97nhz.mirror.aliyuncs.com&quot; ]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><h2 id="docker-入门教程"><a href="#docker-入门教程" class="header-anchor">#</a> <a href="http://www.ruanyifeng.com/blog/2018/02/docker-tutorial.html" target="_blank" rel="noopener noreferrer">Docker 入门教程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></h2> <h3 id="image-文件"><a href="#image-文件" class="header-anchor">#</a> image 文件</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 列出本机的所有 image 文件。</span>
$ docker image <span class="token function">ls</span>

<span class="token comment"># 删除 image 文件</span>
$ docker image <span class="token function">rm</span> <span class="token punctuation">[</span>imageName<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="容器文件"><a href="#容器文件" class="header-anchor">#</a> 容器文件</h3> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 列出本机正在运行的容器</span>
$ docker container <span class="token function">ls</span>

<span class="token comment"># 列出本机所有容器，包括终止运行的容器</span>
$ docker container <span class="token function">ls</span> --all
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p>终止运行的容器文件，依然会占据硬盘空间，可以使用<a href="https://docs.docker.com/engine/reference/commandline/container_rm/" target="_blank" rel="noopener noreferrer"><code>docker container rm</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>命令删除。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container rm [containerID]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="实例"><a href="#实例" class="header-anchor">#</a> 实例</h3> <p>首先，运行下面的命令，将 image 文件从仓库抓取到本地。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker image pull library/hello-world
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>上面代码中，<code>docker image pull</code>是抓取 image 文件的命令。<code>library/hello-world</code>是 image 文件在仓库里面的位置，其中<code>library</code>是 image 文件所在的组，<code>hello-world</code>是 image 文件的名字。
由于 Docker 官方提供的 image 文件，都放在<a href="https://hub.docker.com/r/library/" target="_blank" rel="noopener noreferrer"><code>library</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>组里面，所以它的是默认组，可以省略。因此，上面的命令可以写成下面这样。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker image pull hello-world
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>抓取成功以后，就可以在本机看到这个 image 文件了。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker image ls
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>现在，运行这个 image 文件。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container run hello-world
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><code>docker container run</code>命令会从 image 文件，生成一个正在运行的容器实例。
注意，<code>docker container run</code>命令具有自动抓取 image 文件的功能。如果发现本地没有指定的 image 文件，就会从仓库自动抓取。因此，前面的<code>docker image pull</code>命令并不是必需的步骤。
如果运行成功，你会在屏幕上读到下面的输出。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
... ...
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>输出这段提示以后，<code>hello world</code>就会停止运行，容器自动终止。
有些容器不会自动终止，因为提供的是服务。比如，安装运行 Ubuntu 的 image，就可以在命令行体验 Ubuntu 系统。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container run -it ubuntu bash
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>对于那些不会自动终止的容器，必须使用<a href="https://docs.docker.com/engine/reference/commandline/container_kill/" target="_blank" rel="noopener noreferrer"><code>docker container kill</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 命令手动终止。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container kill [containID]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="dockerfile"><a href="#dockerfile" class="header-anchor">#</a> dockerFile</h3> <p><img src="https://cdn.nlark.com/yuque/0/2020/webp/714491/1602480106829-d4e077eb-849d-48e4-bd1a-0cd36e7d17da.webp#align=left&amp;display=inline&amp;height=296&amp;margin=%5Bobject%20Object%5D&amp;originHeight=296&amp;originWidth=563&amp;size=0&amp;status=done&amp;style=none&amp;width=563" alt=""></p> <h2 id="gui-工具"><a href="#gui-工具" class="header-anchor">#</a> GUI 工具</h2> <p>推荐使用 Portainer 作为容器的 GUI 管理方案。
推荐使用 Portainer 作为容器的 GUI 管理方案。</p> <blockquote><p>官方地址：<a href="https://links.jianshu.com/go?to=https%3A%2F%2Fportainer.io%2Finstall.html" target="_blank" rel="noopener noreferrer">portainer.io/install.htm…<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <p>安装命令</p> <blockquote><p><code>docker volume create portainer_data</code> <code>docker run -d -p ``8000``:8000 -p ``9000``:9000 --name``=``portainer --restart``=``always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce</code></p></blockquote> <h2 id="常用命令汇总"><a href="#常用命令汇总" class="header-anchor">#</a> 常用命令汇总</h2> <div class="language-shell line-numbers-mode"><pre class="language-shell"><code><span class="token comment"># 查看docker基础信息</span>
docker info

<span class="token comment"># 拉取镜像</span>
docker pull <span class="token operator">&lt;</span>image<span class="token operator">&gt;</span>:<span class="token operator">&lt;</span>tag<span class="token operator">&gt;</span>

<span class="token comment"># 移除容器</span>
docker <span class="token function">rm</span> <span class="token operator">&lt;</span>containerId<span class="token operator">&gt;</span>

<span class="token comment"># 移除镜像</span>
docker rmi <span class="token operator">&lt;</span>imageId<span class="token operator">&gt;</span>

<span class="token comment"># 启动、停止、重启容器</span>
docker stop <span class="token operator">&lt;</span>containerId<span class="token operator">&gt;</span>
docker start <span class="token operator">&lt;</span>containerId<span class="token operator">&gt;</span>
docker restart <span class="token operator">&lt;</span>containerId<span class="token operator">&gt;</span>
docker run -itd --name <span class="token operator">&lt;</span>imageName<span class="token operator">&gt;</span> -P/-p<span class="token operator">&lt;</span>port<span class="token operator">&gt;</span>:<span class="token operator">&lt;</span>port<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>imageName<span class="token operator">&gt;</span> /bin/bash

<span class="token comment"># 查看docker容器</span>
docker <span class="token function">ps</span> <span class="token operator">&lt;</span>-a<span class="token operator">&gt;</span>

<span class="token comment"># 打包镜像</span>
docker tag <span class="token operator">&lt;</span>path<span class="token operator">&gt;</span>/<span class="token operator">&lt;</span>name<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>remotePath<span class="token operator">&gt;</span>/<span class="token operator">&lt;</span>name<span class="token operator">&gt;</span>
docker push <span class="token operator">&lt;</span>remotePath<span class="token operator">&gt;</span>/<span class="token operator">&lt;</span>name<span class="token operator">&gt;</span>

<span class="token comment"># 登录docker</span>
docker login <span class="token operator">&lt;</span>remoteIp<span class="token operator">&gt;</span>

<span class="token comment"># 进入容器内部</span>
docker <span class="token builtin class-name">exec</span> -it <span class="token operator">&lt;</span>containerId<span class="token operator">&gt;</span> /bin/bash

<span class="token comment"># 从仓库搜索镜像</span>
docker search <span class="token operator">&lt;</span>imageName<span class="token operator">&gt;</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br></div></div><p><strong>（1）docker container start</strong>
前面的<code>docker container run</code>命令是新建容器，每运行一次，就会新建一个容器。同样的命令运行两次，就会生成两个一模一样的容器文件。如果希望重复使用容器，就要使用<code>docker container start</code>命令，它用来启动已经生成、已经停止运行的容器文件。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container start [containerID]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>（2）docker container stop</strong>
前面的<code>docker container kill</code>命令终止容器运行，相当于向容器里面的主进程发出 SIGKILL 信号。而<code>docker container stop</code>命令也是用来终止容器运行，相当于向容器里面的主进程发出 SIGTERM 信号，然后过一段时间再发出 SIGKILL 信号。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ bash container stop [containerID]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>这两个信号的差别是，应用程序收到 SIGTERM 信号以后，可以自行进行收尾清理工作，但也可以不理会这个信号。如果收到 SIGKILL 信号，就会强行立即终止，那些正在进行中的操作会全部丢失。
<strong>（3）docker container logs</strong> <code>docker container logs</code>命令用来查看 docker 容器的输出，即容器里面 Shell 的标准输出。如果<code>docker run</code>命令运行容器的时候，没有使用<code>-it</code>参数，就要用这个命令查看输出。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container logs [containerID]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>（4）docker container exec</strong> <code>docker container exec</code>命令用于进入一个正在运行的 docker 容器。如果<code>docker run</code>命令运行容器的时候，没有使用<code>-it</code>参数，就要用这个命令进入容器。一旦进入了容器，就可以在容器的 Shell 执行命令了。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container exec -it [containerID] /bin/bash
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><code>exit</code> 容器停止退出
<code>crtl+p+q</code> 容器不停止退出
<strong>（5）docker container cp</strong> <code>docker container cp</code>命令用于从正在运行的 Docker 容器里面，将文件拷贝到本机。下面是拷贝到当前目录的写法。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container cp [containID]:[/path/to/file] .
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="命令行技巧"><a href="#命令行技巧" class="header-anchor">#</a> 命令行技巧</h3> <h4 id="删除所有镜像"><a href="#删除所有镜像" class="header-anchor">#</a> 删除所有镜像</h4> <p>docker rmi -f $(docker images -qa)</p> <h4 id="停用全部运行中的容器"><a href="#停用全部运行中的容器" class="header-anchor">#</a> 停用全部运行中的容器</h4> <p>docker stop $(docker ps -q)</p> <h4 id="删除所有的容器"><a href="#删除所有的容器" class="header-anchor">#</a> 删除所有的容器</h4> <p>docker rm $(docker ps -aq)</p> <h4 id="停用并删除所有容器"><a href="#停用并删除所有容器" class="header-anchor">#</a> 停用并删除所有容器</h4> <p>docker stop $(docker ps -q) &amp; docker rm $(docker ps -aq)</p> <ul><li><p>删除所有为运行的容器 使用linux命令</p> <ul><li><code>docker container ls -f status-exited | awk '${print$1}' | awk 'NR&gt;1' | xargs docker container rm</code></li></ul></li> <li><p>批量启动容器 使用docker命令</p> <ul><li><code>docker container ls -q -f status=created</code> 查找所有状态为created的容器 并获取其ID</li> <li><code>docker container start $(docker container ls -q -f status=created)</code></li></ul></li></ul> <h2 id="docker配置"><a href="#docker配置" class="header-anchor">#</a> docker配置</h2> <h3 id="etc-docker-daemon-json"><a href="#etc-docker-daemon-json" class="header-anchor">#</a> <code>/etc/docker/daemon.json</code></h3> <div class="language-dockerfile line-numbers-mode"><pre class="language-dockerfile"><code>{
    &quot;authorization-plugins&quot;: [],//访问授权插件
    &quot;data-root&quot;: &quot;&quot;,//docker数据持久化存储的根目录
    &quot;dns&quot;: [],//DNS服务器
    &quot;dns-opts&quot;: [],//DNS配置选项，如端口等
    &quot;dns-search&quot;: [],//DNS搜索域名
    &quot;exec-opts&quot;: [],//执行选项
    &quot;exec-root&quot;: &quot;&quot;,//执行状态的文件的根目录
    &quot;experimental&quot;: false,//是否开启试验性特性
    &quot;storage-driver&quot;: &quot;&quot;,//存储驱动器
    &quot;storage-opts&quot;: [],//存储选项
    &quot;labels&quot;: [],//键值对式标记docker元数据
    &quot;live-restore&quot;: true,//dockerd挂掉是否保活容器（避免了docker服务异常而造成容器退出）
    &quot;log-driver&quot;: &quot;&quot;,//容器日志的驱动器
    &quot;log-opts&quot;: {},//容器日志的选项
    &quot;mtu&quot;: 0,//设置容器网络MTU（最大传输单元）
    &quot;pidfile&quot;: &quot;&quot;,//daemon PID文件的位置
    &quot;cluster-store&quot;: &quot;&quot;,//集群存储系统的URL
    &quot;cluster-store-opts&quot;: {},//配置集群存储
    &quot;cluster-advertise&quot;: &quot;&quot;,//对外的地址名称
    &quot;max-concurrent-downloads&quot;: 3,//设置每个pull进程的最大并发
    &quot;max-concurrent-uploads&quot;: 5,//设置每个push进程的最大并发
    &quot;default-shm-size&quot;: &quot;64M&quot;,//设置默认共享内存的大小
    &quot;shutdown-timeout&quot;: 15,//设置关闭的超时时限(who?)
    &quot;debug&quot;: true,//开启调试模式
    &quot;hosts&quot;: [],//监听地址(?)
    &quot;log-level&quot;: &quot;&quot;,//日志级别
    &quot;tls&quot;: true,//开启传输层安全协议TLS
    &quot;tlsverify&quot;: true,//开启输层安全协议并验证远程地址
    &quot;tlscacert&quot;: &quot;&quot;,//CA签名文件路径
    &quot;tlscert&quot;: &quot;&quot;,//TLS证书文件路径
    &quot;tlskey&quot;: &quot;&quot;,//TLS密钥文件路径
    &quot;swarm-default-advertise-addr&quot;: &quot;&quot;,//swarm对外地址
    &quot;api-cors-header&quot;: &quot;&quot;,//设置CORS（跨域资源共享-Cross-origin resource sharing）头
    &quot;selinux-enabled&quot;: false,//开启selinux(用户、进程、应用、文件的强制访问控制)
    &quot;userns-remap&quot;: &quot;&quot;,//给用户命名空间设置 用户/组
    &quot;group&quot;: &quot;&quot;,//docker所在组
    &quot;cgroup-parent&quot;: &quot;&quot;,//设置所有容器的cgroup的父类(?)
    &quot;default-ulimits&quot;: {},//设置所有容器的ulimit
    &quot;init&quot;: false,//容器执行初始化，来转发信号或控制(reap)进程
    &quot;init-path&quot;: &quot;/usr/libexec/docker-init&quot;,//docker-init文件的路径
    &quot;ipv6&quot;: false,//开启IPV6网络
    &quot;iptables&quot;: false,//开启防火墙规则
    &quot;ip-forward&quot;: false,//开启net.ipv4.ip_forward
    &quot;ip-masq&quot;: false,//开启ip掩蔽(IP封包通过路由器或防火墙时重写源IP地址或目的IP地址的技术)
    &quot;userland-proxy&quot;: false,//用户空间代理
    &quot;userland-proxy-path&quot;: &quot;/usr/libexec/docker-proxy&quot;,//用户空间代理路径
    &quot;ip&quot;: &quot;0.0.0.0&quot;,//默认IP
    &quot;bridge&quot;: &quot;&quot;,//将容器依附(attach)到桥接网络上的桥标识
    &quot;bip&quot;: &quot;&quot;,//指定桥接ip
    &quot;fixed-cidr&quot;: &quot;&quot;,//(ipv4)子网划分，即限制ip地址分配范围，用以控制容器所属网段实现容器间(同一主机或不同主机间)的网络访问
    &quot;fixed-cidr-v6&quot;: &quot;&quot;,//（ipv6）子网划分
    &quot;default-gateway&quot;: &quot;&quot;,//默认网关
    &quot;default-gateway-v6&quot;: &quot;&quot;,//默认ipv6网关
    &quot;icc&quot;: false,//容器间通信
    &quot;raw-logs&quot;: false,//原始日志(无颜色、全时间戳)
    &quot;allow-nondistributable-artifacts&quot;: [],//不对外分发的产品提交的registry仓库
    &quot;registry-mirrors&quot;: [],//registry仓库镜像
    &quot;seccomp-profile&quot;: &quot;&quot;,//seccomp配置文件
    &quot;insecure-registries&quot;: [],//非https的registry地址
    &quot;no-new-privileges&quot;: false,//禁止新优先级(??)
    &quot;default-runtime&quot;: &quot;runc&quot;,//OCI联盟(The Open Container Initiative)默认运行时环境
    &quot;oom-score-adjust&quot;: -500,//内存溢出被杀死的优先级(-1000~1000)
    &quot;node-generic-resources&quot;: [&quot;NVIDIA-GPU=UUID1&quot;, &quot;NVIDIA-GPU=UUID2&quot;],//对外公布的资源节点
    &quot;runtimes&quot;: {//运行时
        &quot;cc-runtime&quot;: {
            &quot;path&quot;: &quot;/usr/bin/cc-runtime&quot;
        },
        &quot;custom&quot;: {
            &quot;path&quot;: &quot;/usr/local/bin/my-runc-replacement&quot;,
            &quot;runtimeArgs&quot;: [
                &quot;--debug&quot;
            ]
        }
    }
}
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br></div></div><h3 id="更换镜像源"><a href="#更换镜像源" class="header-anchor">#</a> 更换镜像源</h3> <ol><li>首先，修改配置文件 <code>vi /etc/docker/daemon.json</code></li></ol> <div class="language-dockerfile line-numbers-mode"><pre class="language-dockerfile"><code>&quot;registry-mirrors&quot;: [&quot;https//registry.docker-cn.com&quot;]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><ol start="2"><li><p>然后，加载Docker配置 <code>systemctl daemon-reload</code></p></li> <li><p>最后，重启Docker服务就好了 <code>systemctl restart docker.service</code></p></li></ol> <p>附：
国内的几个优秀的Docker源</p> <ul><li>Docker中国区官方镜像 <a href="https://registry.docker-cn.com/" target="_blank" rel="noopener noreferrer">https://registry.docker-cn.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>网易蜂巢 <a href="http://hub-mirror.c.163.com/" target="_blank" rel="noopener noreferrer">http://hub-mirror.c.163.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>中国科技大学 <a href="https://docker.mirrors.ustc.edu.cn/" target="_blank" rel="noopener noreferrer">https://docker.mirrors.ustc.edu.cn<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>阿里镜像 xxx.mirror.aliyuncs.com （需要注册，xxx代表你的账号）</li> <li>DaoCloud xxxx.m.daocloud.ip （需要注册，xxx代表你的账号）</li></ul> <h2 id="原理"><a href="#原理" class="header-anchor">#</a> 原理</h2> <h3 id="cnm"><a href="#cnm" class="header-anchor">#</a> CNM</h3> <p><img src="https://cdn.nlark.com/yuque/0/2020/png/714491/1604573908501-f5829082-6b0c-401a-82e5-66b557d479e8.png#align=left&amp;display=inline&amp;height=395&amp;margin=%5Bobject%20Object%5D&amp;name=image.png&amp;originHeight=395&amp;originWidth=721&amp;size=174736&amp;status=done&amp;style=none&amp;width=721" alt="image.png"> <strong>CNM Drivers</strong> <strong><img src="https://cdn.nlark.com/yuque/0/2020/png/714491/1604573952037-1c1dd9dd-3516-4e26-ab2c-d3c345cfb508.png#align=left&amp;display=inline&amp;height=370&amp;margin=%5Bobject%20Object%5D&amp;name=image.png&amp;originHeight=370&amp;originWidth=666&amp;size=143617&amp;status=done&amp;style=none&amp;width=666" alt="image.png"></strong></p> <h3 id="容器内部网络空间是否与外面一致"><a href="#容器内部网络空间是否与外面一致" class="header-anchor">#</a> 容器内部网络空间是否与外面一致</h3> <p>在容器外<code>ip a</code>
查看容器内所有<code>ip:``docker container exec ${containerName} ip a</code></p> <h3 id=""><a href="#" class="header-anchor">#</a></h3> <h2 id="-2"><a href="#-2" class="header-anchor">#</a></h2> <h2 id="docker-微服务"><a href="#docker-微服务" class="header-anchor">#</a> docker 微服务</h2> <h2 id="-3"><a href="#-3" class="header-anchor">#</a></h2> <hr> <h2 id="nginx-容器教程"><a href="#nginx-容器教程" class="header-anchor">#</a> <a href="https://www.yuque.com/izhaong/blog/pdeegh#Uyci8" target="_blank" rel="noopener noreferrer">Nginx 容器教程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></h2> <h3 id="http-服务"><a href="#http-服务" class="header-anchor">#</a> HTTP 服务</h3> <p>Nginx 的最大作用，就是搭建一个 Web Server。有了容器，只要一行命令，服务器就架设好了，完全不用配置。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container run \
  -d \
  -p 127.0.0.1:8080:80 \
  --rm \
  --name mynginx \
  nginx
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>上面命令下载并运行官方的 <a href="https://hub.docker.com/_/nginx/" target="_blank" rel="noopener noreferrer">Nginx image<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>，默认是最新版本（latest），当前是 1.13.9。如果本机安装过以前的版本，请删掉重新安装，因为只有 1.13.9 才开始支持 server push。
上面命令的各个参数含义如下。</p> <blockquote><ul><li><code>-d</code>：在后台运行</li> <li><code>-p</code> ：容器的<code>80</code>端口映射到<code>127.0.0.1:8080</code></li> <li><code>--rm</code>：容器停止运行后，自动删除容器文件</li> <li><code>--name</code>：容器的名字为<code>mynginx</code></li></ul></blockquote> <h2 id="映射网页目录"><a href="#映射网页目录" class="header-anchor">#</a> 映射网页目录</h2> <p>网页文件都在容器里，没法直接修改，显然很不方便。下一步就是让网页文件所在的目录<code>/usr/share/nginx/html</code>映射到本地。
首先，新建一个目录，并进入该目录。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ mkdir nginx-docker-demo
$ cd nginx-docker-demo
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>然后，新建一个<code>html</code>子目录。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ mkdir html
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>在这个子目录里面，放置一个<code>index.html</code>文件，内容如下。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>&lt;h1&gt;Hello World&lt;/h1&gt;
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>接着，就可以把这个子目录<code>html</code>，映射到容器的网页文件目录<code>/usr/share/nginx/html</code>。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>$ docker container run \
  -d \
  -p 127.0.0.1:8080:80 \
  --rm \
  --name mynginx \
  --volume &quot;$PWD/html&quot;:/usr/share/nginx/html \
  nginx
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><p>打开浏览器，访问 127.0.0.1:8080，应该就能看到 Hello World 了。</p> <h2 id="使用的案例"><a href="#使用的案例" class="header-anchor">#</a> 使用的案例</h2> <ul><li>创建mysql5.7
<ul><li><code>docker run -p 33306:3306 -e MYSQL_ROOT_PASSWORD=qq164165005 --name eggmysql -d mysql:5.7</code></li></ul></li></ul> <h2 id="在使用docker中遇到的问题-需求"><a href="#在使用docker中遇到的问题-需求" class="header-anchor">#</a> 在使用docker中遇到的问题&amp;需求</h2> <h3 id="问题"><a href="#问题" class="header-anchor">#</a> 问题</h3> <h4 id="docker启动时的报错汇总"><a href="#docker启动时的报错汇总" class="header-anchor">#</a> <a href="https://www.jianshu.com/p/93518610eea1" target="_blank" rel="noopener noreferrer">Docker启动时的报错汇总<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></h4> <hr> <ul><li>Failed to start Docker Application Container Engine.</li></ul> <p>修改/etc/docker/daemon.json这个文件</p> <div class="language-dockerfile line-numbers-mode"><pre class="language-dockerfile"><code>&quot;registry-mirrors&quot;: [&quot;https://docker.mirrors.ustc.edu.cn&quot;]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><hr> <ul><li>docker.service failed.</li></ul> <hr> <ul><li>Failed to restart docker.service: Unit not found.</li></ul> <p><strong>docker.service启动失败：Unit not found的原因及解决办法</strong>
删除/usr/lib/systemd/system/docker.service的[UNIT]里包含的docker.socket，然后systemctl daemon-reload，最后systemctl start docker.service，发现启动成功了。
类似情况
如果是类似的情况，缺少docker.socket，但是新版本需要docker.socket。有两种方法可以解决该问题:</p> <ol><li>可以卸载docker，再重新安装，即可出现docker.socket。或者</li> <li>创建一个/usr/lib/systemd/system/docker.socket文件，然后systemctl
daemon-reload，最后systemctl start docker.service，即可启动成功。</li></ol> <hr> <h4 id="当构建完镜像启动容器时失败"><a href="#当构建完镜像启动容器时失败" class="header-anchor">#</a> 当构建完镜像启动容器时失败</h4> <ul><li><p>在最后加上 <code>sh -c &quot;while true; do sleep 3600; done&quot;</code></p></li> <li><p>DockerFile 最后加入 <code>ENTRYPOINT [&quot;sh&quot;, &quot;-c&quot;, &quot; exec tail -f /dev/null&quot;]</code>防止容器启动就退出, 用这个命令一直前台阻塞</p></li> <li><p>删除未启动的容器 重新构建镜像</p></li> <li><p>进入容器<code>docker exec [contianerID] -it /bin/sh</code></p></li></ul> <p>查看文件类型  .sh    设置文件类型<code>set ff=&quot;unix&quot;</code></p> <h4 id="permission-denied"><a href="#permission-denied" class="header-anchor">#</a> permission denied</h4> <ul><li><p>sudo docker image ls</p></li> <li><p>sudo goupadd docker</p></li> <li><p>sudo gpasswd -a ${USER} docker</p></li> <li><p>sudo service docker restart</p></li> <li><p>logout 重新登录下</p></li></ul> <h4 id="运行node项目-自动退出"><a href="#运行node项目-自动退出" class="header-anchor">#</a> 运行node项目 自动退出</h4> <p>运行容器的时候     自动进入项目命令行交互界面敲击</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>docker run -it pptr-image bash
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h3 id="需求收集"><a href="#需求收集" class="header-anchor">#</a> 需求收集</h3> <h4 id="容器中调用宿主机docker命令"><a href="#容器中调用宿主机docker命令" class="header-anchor">#</a> 容器中调用宿主机docker命令</h4> <p><a href="https://blog.csdn.net/nanhavezhi/article/details/103079056" target="_blank" rel="noopener noreferrer">https://blog.csdn.net/nanhavezhi/article/details/103079056<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>
在构建容器时加上docker的目录映射</p> <div class="language-java line-numbers-mode"><pre class="language-java"><code><span class="token operator">-</span>v <span class="token operator">/</span>run<span class="token operator">/</span>docker<span class="token punctuation">.</span>sock<span class="token operator">:</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span>docker<span class="token punctuation">.</span>sock  \
<span class="token operator">-</span>v <span class="token operator">/</span>bin<span class="token operator">/</span>docker<span class="token operator">:</span><span class="token operator">/</span>bin<span class="token operator">/</span>docker    
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h4 id="在容器外执行某个容器内的某个命令操作"><a href="#在容器外执行某个容器内的某个命令操作" class="header-anchor">#</a> 在容器外执行某个容器内的某个命令操作</h4> <p>命令如下 加上<code>-c $cmd</code></p> <div class="language-dockerfile line-numbers-mode"><pre class="language-dockerfile"><code>sudo docker exec -it $DOCKER_ID /bin/bash -c 'cd /packages/detectron &amp;&amp; python tools/train.py'
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></div></div> <!----> <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2021/11/30, 20:56:45</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/pages/b4e72c/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">开源的物联网平台thingsboard部署</div></a> <a href="/pages/3eb92e11/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">Docker 学习</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/pages/b4e72c/" class="prev">开源的物联网平台thingsboard部署</a></span> <span class="next"><a href="/pages/3eb92e11/">Docker 学习</a>→
      </span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/pages/749ce2/"><div>
            css 变量使用
            <!----></div></a> <span class="date">01-26</span></dt></dl><dl><dd>02</dd> <dt><a href="/pages/9ee936/"><div>
            js 精准和模糊获取dom
            <!----></div></a> <span class="date">01-26</span></dt></dl><dl><dd>03</dd> <dt><a href="/pages/2a8bd5/"><div>
            在 Javascript 和 Sass（或 CSS！）之间共享变量的方法
            <!----></div></a> <span class="date">01-25</span></dt></dl> <dl><dd></dd> <dt><a href="/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="mailto:izhaong@outlook.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://github.com/izhaong" title="GitHub" target="_blank" class="iconfont icon-github"></a><a href="https://music.163.com/#/playlist?id=755597173" title="听音乐" target="_blank" class="iconfont icon-erji"></a></div> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2021-2022
    <span>izhaong | <a href="https://github.com/izhaong" target="_blank">github</a> | <a href="http://beian.miit.gov.cn/" target="_blank">蜀ICP备2021031194号</a></span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <div class="body-bg" style="background:url() center center / cover no-repeat;opacity:0.5;"></div> <!----> <!----></div><div class="global-ui"><div></div></div></div>
    <script src="/assets/js/app.2005d9cf.js" defer></script><script src="/assets/js/2.26fadcea.js" defer></script><script src="/assets/js/62.ec59ffa8.js" defer></script>
  </body>
</html>
